home *** CD-ROM | disk | FTP | other *** search
- /* Double Buffering
- ** ----------------
- ** This just shows how to double buffer the screen. You can also try out
- ** triple buffering just by changing the DBLBUFFER flag to TPLBUFFER in the
- ** ScreenStruct.
- **
- ** Notice that this thing does in fact fully multi-task (no forbid/permit)!
- ** Instead we set our task priority to be a little higher than any other
- ** tasks -- if we didn't do this sometimes our frames could be stalled (try
- ** removing the SetUserPri and watch the demo again).
- */
-
- MODULE 'games','games/games'
-
- PROC main()
- DEF screen:PTR TO gamescreen, palette:PTR TO INT, loadpic:PTR TO picture
-
- palette := [ $0000,$0130,$0FCB,$0FA9,$0D88,$0965,$0644,$0211,
- $0400,$0444,$0FF0,$0432,$0CC0,$0150,$0501,$0880,
- $0261,$0271,$0382,$0492,$05A3,$05B4,$0677,$06C4,
- $0788,$09AA,$0BCC,$0801,$0901,$0A02,$0701,$0601
- ]:INT;
-
- screen := [ GSV1,0,
- 0,0,0, -> Screen_Mem1/2/3
- 0, -> Screen link.
- palette, -> Address of palette.
- 0, -> Address of rasterlist.
- 0, -> Amt of colours in palette.
- 320,256,320,256, -> Screen & Pic Height/Width.
- 5, -> Amt of planes.
- 0,0, -> Top of screen offsets, X/Y
- 0,0, -> X/Y counters (for scrolling).
- DBLBUFFER, -> Special attributes.
- LORES, -> Screen mode.
- INTERLEAVED, -> Screen type
- 0 -> Reserved area.
- ]:gamescreen;
-
- loadpic := [ PCV1,0, -> Version header.
- 0, -> Destination.
- 320,256, -> Width, Height.
- 5, -> Amount of Planes.
- 32, -> Amount of colours.
- palette, -> Palette (remap).
- LORES, -> Screen mode.
- INTERLEAVED, -> Destination.
- 0 -> Parameters.
- ]:picture;
-
- IF gmsbase := OpenLibrary('games.library',0)
- SetUserPri()
- IF (Add_Screen(screen) = ERR_OK)
- loadpic.data := screen.memptr1;
- IF (LoadPic('GAMESLIB:data/IFF.Pic320',loadpic) = ERR_OK)
- Show_Screen(screen)
- REPEAT
- Wait_OSVBL()
- SwapBuffers(screen)
- UNTIL !(Read_Mouse(JPORT1) AND MB_LMB)
- ENDIF
- Delete_Screen(screen)
- ENDIF
- CloseLibrary(gmsbase)
- ENDIF
- ENDPROC
-
-